import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';

//测试工具修改处:新增
import finalCreateStore from './store/index';
import reducer from './reducers/index'
import { syncHistoryWithStore } from 'react-router-redux';
import DevTools from './store/DevTools';

import {Router,Route,hashHistory,IndexRoute} from 'react-router';


import App from './modules/App'
import About from './modules/About'
import Home from './modules/Home'
import CounterContext from './modules/Counter'
import CartsContext from './modules/Carts'

//测试工具修改处:新增
const store = finalCreateStore(reducer);
const history = syncHistoryWithStore(hashHistory,store); 

ReactDOM.render(
    <Provider store={store}>
        <div>{/*Provider下只能有一个根标签*/}
            <Router history={history}>{/*测试工具修改处：hashHistory改为history*/}
                <Route path="/" component={App}>
                    <IndexRoute component={Home}/>
                    <Route path="/about" component={About}/>
                    <Route path="/counter" component={CounterContext}/>
                    <Route path="/carts" component={CartsContext}/>
                </Route>
            </Router>
            <DevTools/>{/*测试工具修改处:新增*/}
        </div>
    </Provider>
    ,
    document.getElementById('app')
)